package com.example.fragment_work;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

import androidx.fragment.app.Fragment;

import java.io.Serializable;
import java.util.List;

public class RightFragment  extends Fragment {
    private ListView listView;
    public RightFragment(){
    }
    public RightFragment getInstance(List<FoobBeen> list){
        RightFragment rightFragment = new RightFragment();
        Bundle bundle = new Bundle();
        bundle.putSerializable("list",(Serializable) list);
        rightFragment.setArguments(bundle);
        return rightFragment;
    }
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.right_layout,container,false);
        listView = view.findViewById(R.id.lv_list);
        if (getArguments() != null) {
            List<FoobBeen> list = (List<FoobBeen>) getArguments().getSerializable("list");
            RightAdapter adapter = new RightAdapter(getActivity(),list);
            listView.setAdapter(adapter);
        }
        return view;
    }
}
